Auto merge of #1804 - alexcrichton:aggressively-backtrack, r=brson
authorbors <bors@rust-lang.org>
Fri, 17 Jul 2015 20:26:42 +0000 (20:26 +0000)
committerbors <bors@rust-lang.org>
Fri, 17 Jul 2015 20:26:42 +0000 (20:26 +0000)
commita10897c20de22a3ba6f47d1cb551a962a5e160f2
treedbdd6e07524d4e96da97a4c61a66b4615f700b32
parent19232413869f17e3b12e93663c955d83fde76977
parentbcdb7473def152307fe8ee229f937a0c4d900bd4
Auto merge of #1804 - alexcrichton:aggressively-backtrack, r=brson

Resolving a dependency graph may involve quite a bit of backtracking to select
different versions of crates, but the previous implementation of resolution
would not backtrack enough.

Once a dependency is completely resolved it's possible that any number of
candidates for its transitive dependencies were left out of the resolution
process (e.g. we didn't hit them yet). These candidates were not previously used
for backtracking (because resolution overall of the dependency finished), but
this commit alters the implementation to instead consider these as candidates
for backtracking.

Architecturally this changes the code to CPS to pass around a `finished`
continuation to allow tweaking the behavior whenever a dependency successfully
resolves. The key change is then that whenever a candidate for a dependency is
activated, we ensure the recursive step for the rest of the graph happens as a
sub-call. This means that if *anything* in the recursive call fails (including
some previous up-the-stack resolution) we'll retry the next candidate.

Closes #1800